Python for Unix and Linux System Administration by Noah Gift;Jeremy M. Jones

Python for Unix and Linux System Administration by Noah Gift;Jeremy M. Jones

Author:Noah Gift;Jeremy M. Jones
Format: mobi, pdf
Tags: COMPUTERS / Networking / General
Publisher: O'Reilly Media
Published: 2009-06-29T23:00:00+00:00


We hope you are paying attention to the fact that this script has very few differences from the snmpdf command, with the exception of things being named differently. This is a perfect example of when it becomes a good idea to create another level of abstraction and then resuse common components. If we created a module to handle all of the boilerplate code, our new script would be only a few lines long. Keep this in mind; we will revist this later.

Another tool, related to SNMP, is ARP, which uses the ARP protocol. By using ARP protocol, it is possible to obtain Mac addresses of devices based on their IP address if you are physically located on the same network. Let’s write one of those tools too. This one-off tool will come in handy a little later.

ARP is so easy to wrap up into a script that it is better to just show an example by using IPython interactively. Go ahead and fire up IPython, and try this out:

import re

import subprocess



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.